import React, {useEffect} from 'react';
import {bindActionCreators} from "redux";
import {connect} from "react-redux";
import {Col, Row} from "reactstrap";
import {setFieldData} from "../../../../../../redux/actions/helper";
import {SET_SCHEDULABLE_FIELD, SET_SCHEDULE_FIELD} from "../../../../../../redux/constants/schedules";
import {SET_EVENT_INFO_FIELD} from "../../../../../../redux/constants/eventDetail/tabInfo";
import DataAndTime from "../Components/DataAndTime";


const Todo = props => {
  const {setFieldData, schedule, scheduleId, todo} = props;

  useEffect(() => {
  }, [])


  return (
    <React.Fragment>
      <Row>
        <Col md={5}>
          <div className="description"/>
          <textarea
            placeholder={'Описание'}
            onChange={e => setFieldData(SET_SCHEDULABLE_FIELD, 'description', e.target.value)}
            value={todo.description}
            className={`schedule-input schedule-item schedule-input-description w-100`}
          />
        </Col>
        <Col md={7}>
          <Row>
            <Col>
              <DataAndTime
                dateDesc={'Дата начала'}
                timeDesc={'Время начала'}
                begin={schedule.begin}
                end={schedule.end}
                setFieldData={setFieldData}
                type="begin"
              />
            </Col>
          </Row>
        </Col>
      </Row>
    </React.Fragment>
  );

}

const mapStateToProps = state => ({
  todo: state.schedules.schedule.schedulable
});
const mapDispatchToProps = dispatch => bindActionCreators({
  setFieldData
}, dispatch);

export default connect(mapStateToProps, mapDispatchToProps)(Todo);
